<?php

class ShiftTable extends Doctrine_Table
{
    public function getMissingShifts(Position $position){
        $shiftAssignments = $position->getShiftAssignment();
        $foundSAIds = array();
        $i=0;
        foreach ($shiftAssignments as $sa) {
            $foundSAIds[$i++] = $sa->getShiftId();
        }
        sfContext::getInstance()->getLogger()->debug('Count assing: ' . count($foundSAIds));
        $q = $this->createQuery('s');
        if(count($foundSAIds)>0){
            $q->whereNotIn('s.id', $foundSAIds);
        }
        
        return $q->execute();

    }
}
